/*
  This file is part of 'Trivial chess'.

  'Trivial chess' is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  'Trivial chess' is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with 'Trivial chess'.  If not, see <http://www.gnu.org/licenses/>.
*/

/* SVN FILE: $Id$ */
/**
 * @author         $Author$
 * @version        $Rev$
 * @lastrevision   $Date$
 * @filesource     $URL$
 */

#ifndef SQUAREVECTORABSTRACT_H_
#define SQUAREVECTORABSTRACT_H_


template<class Square,class FS,class RS,typename Int>
class SquareVectorAbstract {
public:
	typedef FS FileScalar;
	typedef RS RankScalar;
public:
	template<class Vector>
	friend Square operator+(const Square square, const Vector vector) {
		typename Square::File file = square.file() + vector.fileScalar();
		if ( file.isNil() )
			return Square::NIL();

		typename Square::Rank rank = square.rank() + vector.rankScalar();
		if ( rank.isNil() )
			return Square::NIL();

		return Square(file, rank);
	}

	template<class Vector>
	friend Square operator+=(Square& square, const Vector vector) {
		square = square + vector;
		return Square(square);
	}
};

#endif /* SQUAREVECTORABSTRACT_H_ */
